CROSS_COMPILE = arm-none-eabi-

CROSS_LIBPATH = "C:\codebench\lib\gcc\arm-none-eabi\4.8.3"
CROSS_LIBPATH2 = "C:\codebench\arm-none-eabi\lib"
PROJECT = 2416
export CROSS_COMPILE CROSS_LIBPATH PROJECT
LIBS = -lgcc -lc -lm -L $(CROSS_LIBPATH) -L  $(CROSS_LIBPATH2)

include rules.mk
CFLAGS = -mcpu=arm926ej-s -mfloat-abi=softfp
LDFLAGS = -nostartfiles -T $(LDSCRIPT) $(LIBS) 
#-nostartfiles
AFLAGS = 
ARFLAGS = cr
CFLAGS = -Wall
CFLAGS += -I raw-os/include -I raw-os/extension/include -I port -I bsp -I bsp/include
CFLAGS += -I extension/include -I system
CFLAGS += -I ugfx -I ugfx/src/gadc -I ugfx/src/gaudio -I ugfx/src/gdisp/mcufont -I ugfx/src/gevent
CFLAGS += -I ugfx/src/gfile -I ugfx/src/ginput -I ugfx/src/gmisc -I ugfx/src/gqueue -I ugfx/src/gtimer
CFLAGS += -I ugfx/src/gwin -I ugfx/src/gos -I ugfx/drivers/gdisp/framebuffer -I ugfx/drivers/ginput/touch/helper2416
CFLAGS += -I ugfx/boards/base/helper2416 -I ugfx/app
CFLAGS += -g -O2 

DEFS = 
INC = 
OBJS = 
export DEFS INC LIBS OBJS

include bsp/board.mk
include port/port.mk
include raw-os/sys.mk
include extension/extension.mk
include system/system.mk
include test/test.mk
include ugfx_port/ugfx.mk

ALL = $(PROJECT).bin
.PHONY: all clean

all: $(ALL)
$(PROJECT).bin: $(PROJECT).elf
	@echo 'Invoking: Cross ARM GNU Create Flash Image'
	@$(OBJCOPY) ${OBJCFLAGS} -S -O binary $< $@	

$(PROJECT).elf: $(OBJS) $(LDSCRIPT)
	@echo 'Building target: $@'
	@$(CC) $(LDFLAGS) -Wl,-Map,2416.map -o $(PROJECT).elf $(OBJS)

%.o: %.S
	@echo 'Building file: $<'
	@$(CC) $(AFLAGS) -c -o $@ $<
%.o: %.c
	@echo 'Building file: $<'
	@echo $(CFLAGS)
	@$(CC) $(CFLAGS) -c -o $@ $<

clean:
	-rm -f $(PROJECT).elf 2416.map $(PROJECT).bin $(OBJS)
	






